package com.example.ioc.v1;

public class Main {
    public static void main(String[] args) {
        Car car = new Car();
        car.run();
    }
}

class Car {
    private Framework framework;
    public Car() {
        framework = new Framework();
        System.out.println("car init");
    }
    public void run() {
        System.out.println("car run run!");
    }
}

//车身
class Framework {
    private Bottom bottom;
    public Framework() {
        bottom = new Bottom();
        System.out.println("Framework init");
    }
}

//底盘
class Bottom {
    private Tire tire;
    public Bottom() {
        tire = new Tire();
        System.out.println("bottom init");
    }
}

//轮子
class Tire {
    //轮子尺寸
    private int size;
    public Tire() {
        this.size = 15;
        System.out.println("tire init");
    }
}
